<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/sys/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改批次产品信息</title>
<%@ include file="/WEB-INF/sys/include/css.jsp"%>
<link href="${path}/res/js/webuploader/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form" action="${path}/products/update.json" method="post">
<div class="form">
	<div class="group">
		<div class="label">地块名称:</div>
		<div class="text">${plant.blockName }</div>
	</div>
	<div class="group">
		<div class="label">种植作物:</div>
		<div class="text">${cropName }</div>
	</div>
	<div class="group">
		<div class="label">*产品名称:</div>
		<div class="item"><input type="text" name="pdtname" id="pdtname" maxlength="50" value="${products.pdtname }" /></div>
	</div>
	<div class="group">
		<div class="label">*生产日期:</div>
		<div class="item"><input type="text" name="endTime" id="endTime" ltype="date" value="<fmt:formatDate value="${products.endTime }" pattern="yyyy-MM-dd" />" /></div>
		<div class="item" id="endTimeTip"></div>
	</div>
	<div class="group">
		<div class="label">*生产数量:</div>
		<div class="item"><input type="text" name="amount" id="amount" maxlength="10" value="${products.amount }" /></div>
		<div class="text">&nbsp;${crops.units }&nbsp;</div>
		<div class="item" id="amountTip"></div>
	</div>
	<div class="group">
		<div class="label">*生产负责人:</div>
		<div class="item">
			<input type="text" id="workerName" name="workerName" />
			<input type="hidden" name="worker" id="worker" value="${products.worker }" />
		</div>
		<div class="item" id="workerNameTip"></div>
	</div>
	<div class="group">
		<div class="label">产品状态:</div>
		<div class="item">
			<input type="radio" id="status0" name="status" value="0" ${products.status=='0'?'checked="checked"':'' } /><label for="status0" class="label">未确认</label>
			<input type="radio" id="status1" name="status" value="1" ${products.status=='1'?'checked="checked"':'' } /><label for="status1" class="label">已确认</label>
		</div>
	</div>
	<div class="group">
		<div class="label">产品图片:</div>
		<div class="item"><div id="pdtimg" class="myuploader myuploader-single">${products.pdtimg }</div></div>
	</div>
	<div class="group">
		<div class="label">备注:</div>
		<div class="item"><textarea id="remark" name="remark">${products.remark }</textarea></div>
	</div>
	<div class="group">
		<div class="label">资质证明:</div>
		<div class="item"><div id="productsReports" class="myuploader">${productsReports }</div></div>
	</div>
	<div class="buttons">
		<button class="highlight" id="submit1" type="button">确定</button>
		<button type="button" id="cancel1">取消</button>
		<input type="hidden" id="pdtid" name="pdtid" value="${products.pdtid }" />
	</div>
</div>
</form>
<%@ include file="/WEB-INF/sys/include/script.jsp" %>
<script src="${path}/res/js/webuploader/webuploader.min.js" type="text/javascript"></script>
<script src="${path}/res/js/webuploader/myUploader.js" type="text/javascript"></script>
<script type="text/javascript">
var myuploader,productsReportsUploader;
$(function() {
	myuploader = $("#pdtimg").myImgUploader({
		uploadDir: "products_img"
	});
	createSelect("workerName", "worker", {
		valueField:'userid', textField: 'username',
		url:'${path}/userPark/getParkUserData.json?parkid=${plant.parkid}'
	});
	
	productsReportsUploader = $("#productsReports").myUploader({
		uploadDir: "products_img",
		type: "report",
		canEditDesc: true
	});
	
	$("#form").ligerForm({inputWidth: 300});
	
	verifyForm("form", {}, function(){
		$("#form").ajaxForm(function(data){
			UiUtil.isSuccess(data, "修改批次产品信息成功", function(){
				UiUtil.closeForm(true);
			});
		});
	});
	
	$("#submit1").click(function(){
		UiUtil.lockButton('submit1');
		if(!myuploader.isDone() || !productsReportsUploader.isDone()){
			UiUtil.unlockButton('submit1');
			return
		}
		$("#form").submit();
	});

	$("#cancel1").click(function(){
		UiUtil.closeForm();
	});
	
});
</script>
</body>
</html>